home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cchh01.arc / SQ.H < prev    next >
Text File  |  1986-03-14  |  2KB  |  55 lines

  1. /* Definitions and external declarations */
  2.  
  3. EXTERN char    debug;    /* Boolean flag */
  4.  
  5. /* *** Stuff for first translation module *** */
  6.  
  7. EXTERN int likect;    /*count of consecutive identical chars */
  8. EXTERN int lastchar, newchar;
  9. EXTERN char state;
  10.  
  11. /* states */
  12.  
  13. #define NOHIST    0     /*don't consider previous input*/
  14. #define SENTCHAR 1     /*lastchar set, no lookahead yet */
  15. #define SENDNEWC 2     /*newchar set, previous sequence done */
  16. #define SENDCNT 3     /*newchar set, DLE sent, send count next */
  17.  
  18. /* *** Stuff for second translation module *** */
  19.  
  20. #define NOCHILD -1    /* indicates end of path through tree */
  21. #define NUMNODES (NUMVALS + NUMVALS - 1)    /* nbr of nodes */
  22.  
  23. #define MAXCOUNT 0xFFFF    /* biggest unsigned integer */
  24.  
  25. /* The following array of structures are the nodes of the
  26.  * binary trees. The first NUMVALS nodes becomethe leaves of the
  27.  * final tree and represent the values of the data bytes being
  28.  * encoded and the special endfile, SPEOF.
  29.  * The remaining nodes become the internal nodes of the final tree.
  30.  */
  31.  
  32. EXTERN struct    nd {
  33.     unsigned int weight;    /* number of appearances */
  34.     char tdepth;        /* length on longest path in tre*/
  35.     int lchild, rchild;    /* indexes to next level */
  36. } node[NUMNODES];
  37.  
  38. EXTERN int dctreehd;    /*index to head node of final tree */
  39.  
  40. /* This is the encoding table:
  41.  * The bit strings have first bit in  low bit.
  42.  * Note that counts were scaled so code fits unsigned integer
  43.  */
  44.  
  45. EXTERN char codelen[NUMVALS];        /* number of bits in code */
  46. EXTERN unsigned int code[NUMVALS];    /* code itself, right adjusted */
  47. EXTERN unsigned int tcode;        /* temporary code value */
  48.  
  49.  
  50. /* Variables used by encoding process */
  51.  
  52. EXTERN int curin;        /* Value currently being encoded */
  53. EXTERN char cbitsrem;        /* Number of code string bits remaining */
  54. EXTERN unsigned int ccode;    /* Current code shifted so next code bit is at right */
  55.